package com.example.demo2.controller;

import com.example.demo2.entity.QiLu;
import com.example.demo2.service.QiLuService;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author
 * @version 1.0
 * @description TODO
 * @date 2023/10/17 16:57
 */
@RestController
@RequestMapping("/msg1")
public class QiLuController {

    @Autowired
    private QiLuService qiLuService;

    @GetMapping("/getAll")
    public  List<QiLu> getAll(){
        List<QiLu> list = qiLuService.findQiLuAll();
        return list;
    }
    @GetMapping("/getAllJson")
    public String getAllJson(){
        List<QiLu> list = qiLuService.findQiLuAll();
        Gson gson = new Gson();
        return gson.toJson(list);
    }

}
